-
Notifications
You must be signed in to change notification settings - Fork 996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: AND/OR query filters #3934
Conversation
some more things test case no log cleanup more tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks good in general, but there's some test failures.
One question: are these filters case sensitive? Seeing AND
when everything else is lower case feels a little strange.
In the ticket and to make it more differentiable made these logical filters uppercase. Don’t have a preference so happy to do whatever you think is the best. |
Agree with David, I think lowercase would be more in keeping. And nice work! Can you clarify what you mean by |
This comment was marked as outdated.
This comment was marked as outdated.
@saihaj i think we need a rebase here, and then we are good to go in terms of code review? |
Quick note on rebasing: please always rebase with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Sorry it took so long to review.
Just add another test like I suggested in the comment (or more if you can think of more ;) ) and then feel free to rebase and commit.
musicians( | ||
where: { | ||
or: {and: {name: \"John\", id: \"m1\" }, | ||
or: {and: {name: \"Lisa\", id: \"m2\" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought repeating the same key here was prohibited by the GraphQL spec, or am I misinterpreting this?
Also cc @azf20 for the syntax of writing (name = 'John' and id = 'm1') or (name = 'Lisa' and id = 'm2')
As an alternative, we could maybe have and
and or
take either an object (and: {name: "John", id: "m1"}
) or an array of objects (or: [{and: {name: "John", id: "m1"}}, {and: {name: "Lisa", id: "m2"}}]
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s the way I formatted the query for test it may look like prohibited syntax but it isn’t :)
query {
musicians(
where: {
or: {
and: { name: "John", id: "m1" }
or: { and: { name: "Lisa", id: "m2" } }
}
}
) {
id
name
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saihaj I am a bit confused on what that query is doing, is it effectively:
(name == "John" AND id == "m1") OR (name == "Lisa" AND id == "m2")
Or is it something different? If so I think that syntax is a bit confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes @azf20 that is what the query is doing
Enables users to execute queries with logical operators.
Query Example:
Question: should we limit this to only one level deep?
Closes #579